﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace DataflowListModule.Views.DataflowListView
{
    public partial class DataflowListView : UserControl,IDataflowListView
    {
        public DataflowListView()
        {
            InitializeComponent();
        }

        #region IDataflowListView Members

        public void SetModel(IDataflowListPresentationModel model)
        {
            this.DataContext = model;
            model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(model_PropertyChanged);
        }

        void model_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "ISOK")
            {
                Current.Tab.SelectedItem = Current.Tab.Items[2];
            }
        }

       

        #endregion

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button bt=(Button)sender;
            IDataflowListPresentationModel model = (IDataflowListPresentationModel)this.DataContext;
            model.GetDetail(int.Parse(bt.Tag.ToString()));
        }

        private void Button2_Click(object sender, RoutedEventArgs e)
        {
            Button bt = (Button)sender;
            IDataflowListPresentationModel model = (IDataflowListPresentationModel)this.DataContext;
            model.GetDetail2(int.Parse(bt.Tag.ToString()));
        }

        private void Button1_Click(object sender, RoutedEventArgs e)
        {
            Button bt = (Button)sender;
            IDataflowListPresentationModel model = (IDataflowListPresentationModel)this.DataContext;
            model.GetDetail1(int.Parse(bt.Tag.ToString()));
            
        }

        private void Button3_Click(object sender, System.Windows.RoutedEventArgs e)
        {
        	IDataflowListPresentationModel model = (IDataflowListPresentationModel)this.DataContext;
            model.Refresh();
        }
    }
}
